package com.qf2.factory;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;

/**
 * 用来创建SqlSessionFactory对象的工厂
 */
public class SqlSessionFactoryFactory {

    public static SqlSessionFactory ssf(){
        try {
            InputStream is = Resources.getResourceAsStream("mybatis.xml");

            SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(is);


            return factory;
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }
}
